package org.mikeliu.exp3.homework2;

import java.util.Scanner;

public class Main 
{
	public static void main(String[] args) 
	{
		BankBusiness.welcome();
		
		String name,password;
		Scanner scanner=new Scanner(System.in);
		
		name=scanner.next();
		password=scanner.next();
		BankBusiness account=new BankBusiness(name, password);
		
		double value;
		
		password=scanner.next();
		value=scanner.nextDouble();
		account.deposit(password, value);
		
		password=scanner.next();
		value=scanner.nextDouble();
		account.withdraw(password, value);

		password=scanner.next();
		value=scanner.nextDouble();
		account.withdraw(password, value);
		
		password=scanner.next();
		value=scanner.nextDouble();
		account.withdraw(password, value);
		
		BankBusiness.welcomeNext();
		scanner.close();
		
	}
}

class BankBusiness
{
	public static String bankName="中国银行";
	private String name,password;
	private double balance;
	public static void welcome() 
	{
		System.out.println(bankName+"欢迎您的到来！");
	}
	public static void welcomeNext()
	{
		System.out.println("请收好您的证件和物品，欢迎您下次光临！");
	}
	public BankBusiness(String name, String password) 
	{
		super();
		this.name=name;
		this.password=password;
		this.balance=0;
	}
	public void deposit(String password,double value) 
	{
		if(this.password.equals(password))
		{

			this.balance+=value;
			System.out.println("您的余额有"+balance+"元。");
		}
		else 
		{
			System.out.println("您的密码错误！");
		}
	}
	public void withdraw(String password,double value) {
		if(this.password.equals(password))
		{
			if(this.balance-value>0)
			{
				this.balance-=value;
				System.out.println("请取走钞票，您的余额还有"+this.balance+"元。");
			}
			else 
			{
				System.out.println("您的余额不足！");
			}
		}
		else 
		{
			System.out.println("您的密码错误！");
		}
	}
}